package com.kefu.boss.vo;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.boss.model.BossRole;
import com.kefu.common.vo.AbstractSearchVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel
public class BossRoleSearchVo extends AbstractSearchVo {
    @ApiModelProperty(name = "roleName", value = "角色名称")
    private String roleName;
    @ApiModelProperty(name = "roleStatus", value = "状态：0停用，1启用")
    private Integer roleStatus;
    @ApiModelProperty(name = "roleDesc", value = "角色描述")
    private String roleDesc;
    @Override
    public LambdaQueryWrapper lambdaQuery() {
        LambdaQueryWrapper<BossRole> wrapper = Wrappers.lambdaQuery(BossRole.class);
        if (StrUtil.isNotBlank(roleName)) {
            wrapper.like(BossRole::getRoleName, roleName);
        }
        if (StrUtil.isNotBlank(roleDesc)) {
            wrapper.like(BossRole::getRoleDesc, roleDesc);
        }
        return wrapper;
    }
}
